package day19_1;

import java.util.ArrayList;

/**
 * @ClassName Solution
 * @Description 1. 两数之和
 * @Author clockTown
 * @Date 2021/5/28 21:18
 * @Version 1.0
 */
public class Solution1 {
    public int[] twoSum(int[] nums, int target) {
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            if (list.contains(target - nums[i])){
                return new int[]{i, list.indexOf(target - nums[i])};
            }
            list.add(nums[i]);
        }
        return null;
    }
}
